from typing import Union

from pydantic.v1 import BaseModel

from tinkoff_bot.infrastructure.tinkoff_kassa.enums.payment import PaymentStatus


class Payment(BaseModel):
    amount: int
    orderid: int | str
    success: bool
    paymentid: int
    status: Union[PaymentStatus, str]
    paymenturl: str | None

    def __init__(self, **data):
        data_lower = {key.lower(): value for key, value in data.items()}
        super().__init__(**data_lower)
